"use strict"
const stringDot = {
  get(target, key) {
  	
  	console.log(target, key, target[key])
  	console.log('-----------------------\n')
  	
    const title = target[key].title;
    const len = 5;
    const newTitle = title.length > len
      ? title.substr(0, len) + ".".repeat(3)
      : title;
    target[key].title = newTitle
    return target[key]
  },

  set (target, key, val) {
  	console.log('set....')
  	
  	target[key] = val;
  }

};
const lessons = [
  {
    title: "媒体查询响应式布局",
    category: "css"
  },
  {
    title: "FLEX 弹性盒模型",
    category: "css"
  },
  {
    title: "MYSQL多表查询随意操作",
    category: "mysql"
  }
];
const stringDotProxy = new Proxy(lessons, stringDot);
console.log(stringDotProxy);
console.log(stringDotProxy[0]);
console.log(stringDotProxy[1]);